import { createElement, createTextElement } from "./vdom/index"

export function renderMixin (Vue) {
  Vue.prototype._c = function () {
    return createElement(this, ...arguments)

  }
  Vue.prototype._v = function (text) {
    return createTextElement(this, text)
  }
  Vue.prototype._s = function (val) {
    if (typeof val == 'object') return JSON.stringify(val)
    return val
  }
  Vue.prototype._render = function () {
    const vm = this
    // 就是我们解析出来的render  也有可能是用户写的
    // 加_c ...
    let render = vm.$options.render
    let vnode = render.call(vm)
    return vnode
  }
}